Distance-Based Ramping
The BasicMotion_CamIn_StartModes.project
sample project described here is located in the installation directory of CODESYS under the ..\CODESYS SoftMotion\Examples
directory.
This example shows how to use the StartMode
input of the MC_CamIn
function block. This input is used to configure how the slave axis is synchronized with the master axis when MC_CamIn
is started.
Basically, there are three possible ways:
The slave axis immediately follows the trajectory specified by the cam and the master axis. Depending on the start status of the slave axis, this can lead to a jump in position, velocity, and/or acceleration of the slave axis.
StartMode
:absolute
,relative
The slave axis synchronizes as quickly as possible while maintaining the predefined velocity, acceleration, deceleration, and jerk limits.
StartMode
:ramp_in
,ramp_in_pos
,ramp_in_neg
A master position is specified in the cam where the slave axis should follow the trajectory as specified by the cam and the master axis. Synchronization takes place over a configurable distance from the master axis.
StartMode
:ramp_in_dist
For more information about the MC_CamIn function block, see: MC_CamIn (FB)
Structure of the application
The application consists of a PLC_PRG
program and a Trace. Moreover, there are four virtual axes: the master axis Master
and the three slave axes SlaveAbsolute
, SlaveRampIn
, and SlaveRampInDist
. And there is the cam Cam
.
In the PLC_PRG
program, three instances of MC_CamIn
are executed with the StartMode input
set differently:
ciSlaveAbsolute
withStartMode = absolute
ciSlaveRampIn
withStartMode = ramp_in
ciSlaveRampInDist
withStartMode = ramp_in_dist
The function block instances control the corresponding virtual axes SlaveAbsolute
, SlaveRampIn
, and SlaveRampInDist
. The master axis is moved at a constant velocity using an MC_MoveVelocity
instance.
The trajectories of the three slave axes and the Active
and InSync
outputs of the MC_CamIn
instances can be tracked in the trace.
All MC_CamIn
instances are started when the master axis exceeds position 40:
The
SlaveAbsolute
axis immediately jumps to the set values defined from the cam. The correspondingMC_CamIn
instance is immediatelyActive
andInSync
.The
SlaveRampIn
axis synchronizes while maintaining the commanded dynamic limits. The correspondingMC_CamIn
instance is immediatelyActive
. From master position~114
, the slave axis follows the trajectory specified by the cam and the master axis and theMC_CamIn
instance reportsInSync
.The
SlaveRampInDist
axis first remains stationary until the master axis has approached theMasterSyncPosition
of 120 up to theMasterStartDistance
of 60 configured on theMC_CamIn instance
. Then synchronization begins and theMC_CamIn
instance reportsActive
. When the master axis reaches theMasterSyncPosition
of120
, the slave axis follows the trajectory specified by the cam and the master axis and theMC_CamIn
instance reportsInSync
.
Commissioning
Build the application and download it to a controller.
Start the trace and the application.
In the trace, you can track the movement of the virtual axes.